import router from "../router";

router.beforeEach((to, from, next) => {
    let hasToken = false;
    if (localStorage.getItem("token")!=null){
        hasToken = true;
    }
    if (true) {
        if (to.path === '/') {
            next({path: "/login"})
        } else {
            next();// 继续执行接下来的操作
        }
    } else {
        if (to.path === '/login') {
            next();
        } else {
            next({path: "/login"});
        }
    }

})
